﻿@model DataMongo.Entities.Group
@{
    Layout = "~/Views/Shared/_LayoutProfile.cshtml";
    var list = ViewBag.FriendList as SelectList;
    var check = ViewBag.Selected as List<string>;
}

<div class="row-fluid">
    <div class="span12">
        <div class="box box-bordered">
            <div class="box-title">
                <h3><i class="icon-th-list"></i>Group Name</h3>
            </div>
            <div class="box-content nopadding">
                @using (Html.BeginForm("Members", "Group", FormMethod.Post, new { @class = "form-horizontal form-striped" }))
                {

                    object index = 0;
                     <div class="control-group">
                        <label for="textfield" class="control-label">Group Name</label>
                        <div class="controls">
                            @Html.TextBoxFor(x => x.GroupName, new { @class = "input-xlarge", @placeholder = "Text input" })
                        </div>
                    </div>

                    <div class="control-group">
                        <label for="textfield" class="control-label">Members</label>
                        <div class="controls">
                            @*@Html.ListBox("FriendList", list, new { @class = "input-xlarge", @placeholder = "Text input" })*@

                            <select multiple="multiple" class="input-xlarge" placeholder="Text input">
                                @foreach (var item in list)
                                {
                                    var selected = "";

                                    if (check.Contains(item.Value))
                                    {
                                        selected = "selected";
                                    }
                                    <option value="@item.Value" @selected>@MVCMongo.Services.UtilityService.GetCurrentUserFullName(Convert.ToInt32(item.Text))</option>
                                }

                            </select>
                        </div>
                    </div>


                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary">Save changes</button>
                        <button type="button" class="btn">Cancel</button>
                    </div>
                }
            </div>
        </div>
    </div>
</div>
